package com.gsafety.wellsfort.domain.vo;

import com.gsafety.wellsfort.common.enums.CustomerTypeEnum;
import com.gsafety.wellsfort.domain.model.course.Course;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

@Data
@ApiModel(value = "我的课程列表")
public class MyCourseListVO {
    private Integer id;

    @ApiModelProperty(value = "课程对象值")
    private Integer objectType;
    @ApiModelProperty(value = "课程对象名称")
    private String objectTypeText;

    @ApiModelProperty(value = "课程名称")
    private String name;


    @ApiModelProperty(value = "课程图URL")
    private String imageUrl;

    @ApiModelProperty(value = "缩略图URL")
    private String thumbnailUrl;

    @ApiModelProperty(value = "课程时长")
    private Integer duration;
    @ApiModelProperty(value = "学习进度")
    private String rate;

    public static  class VOBuilder{
        Course course;
        MyCourseListVO courseVO =new MyCourseListVO();
        public VOBuilder(Course q){
            this.course =q;
        }
        public MyCourseListVO build(){
            BeanUtils.copyProperties(course, courseVO);
            courseVO.setObjectTypeText(CustomerTypeEnum.parseVal(courseVO.getObjectType()).label);
            return courseVO;
        }
    }
}
